package com.feizhoutuobang.shapeline.bo.impl;

import java.util.Date;

import com.feizhoutuobang.shapeline.bo.Subscription;
import com.feizhoutuobang.shapeline.util.Calendar;

public class SubscriptionImpl implements Subscription {
	
	private String id;
	private String name;
	private String userId;
	private int maxItemCount;
	private boolean autoDeliver;
	private String cronExpression;
	private String lastDeliverTime = Calendar.INVALID_TIME;
	
	public String getId() {
		return id;
	}
	
	public void setId(String id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public int getMaxItemCount() {
		return maxItemCount;
	}
	
	public void setMaxItemCount(int maxItemCount) {
		this.maxItemCount = maxItemCount;
	}
	
	public boolean isAutoDeliver() {
		return autoDeliver;
	}
	
	public void setAutoDeliver(boolean autoDeliver) {
		this.autoDeliver = autoDeliver;
	}
	
	public String getCronExpression() {
		return cronExpression;
	}
	
	public void setCronExpression(String cronExpression) {
		this.cronExpression = cronExpression;
	}
	
	public String getLastDeliverTime_() {
		return lastDeliverTime;
	}
	
	public void setLastDeliverTime_(String lastDeliverTime) {
		this.lastDeliverTime = lastDeliverTime;
	}
	
	public Date getLastDeliverTime() {
		return Calendar.parse(lastDeliverTime);
	}
	
	public void setLastDeliverTime(Date lastDeliverTime) {
		this.lastDeliverTime = Calendar.format(lastDeliverTime);
	}

//	private String concat(List<Integer> list) {
//		String r = "";
//		for (int i = 0; i < list.size(); i ++) {
//			if (i == 0) {
//				r += list.get(i);
//			}
//			else {
//				r += "," + list.get(i);
//			}
//		}
//		
//		return r;
//	}
//	
//	private List<Integer> split(String s) {
//		List<Integer> r = new ArrayList<Integer>();
//		String[] ary = s.split(",");
//		for (String e : ary) {
//			if (e != null && !e.trim().equals("")) {
//				r.add(Integer.parseInt(e));
//			}
//		}
//		
//		return r;
//	}
}
